package lilei;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * Created by lilei on 2015/8/3.
 */
@Component
@Aspect
public class Audience {
    @Pointcut("execution(public * lilei.PerformImpl.performance(..))")
    public void performance() {}

    @Before("performance()")
    public void takeSeats() {
        System.out.println("the audience are taking their seats");
    }

    @Before("performance()")
    public void turnoffCellPhones() {
        System.out.println("the audience are turning off their cellphones");
    }

    @After("performance()")
    public void applaud() {
        System.out.println("CLAP CLAP...");
    }

    @AfterThrowing("performance()")
    public void DemandRefund() {
        System.out.println("Bool,we want our money back");
    }

    @Around("performance()")
    public void watchPerformance(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("测试环绕通知开始");
        joinPoint.proceed();
        System.out.println("测试环绕通知结束");
    }

    @DeclareParents(value="lilei.Perform+",defaultImpl = UserImpl.class)
    public User user;

}
